#include <unistd.h>
#include <iostream>
#include <thread>
#include <vector>
#include "BlockQueue.hpp"

void Product(BlockQueue<int>* que)
{
   for (int i = 1;;++i) {
      que->push(i); 
      std::cout << "product a task: " << i << std::endl;
      sleep(1);
   }
}

void Consume(BlockQueue<int>* que)
{
   while (true)
   {
      int task = que->pop();
      std::cout << "consume a task: " << task << std::endl;
   }
}

int main()
{
   BlockQueue<int> _que;
   std::thread productor(Product, &_que);
   std::thread consumer(Consume, &_que);
   productor.join();
   consumer.join();
   return 0;
}

